#include "dbg/dbg.h"

class Singleton
{
public:
    Singleton(Singleton const &) = delete;
    Singleton &operator=(Singleton const &) = delete;

    static Singleton *get()
    {
        if (instance_ == nullptr)
        {
            instance_ = new Singleton;
        }

        return instance_;
    }

    static void restart()
    {
        if (instance_)
            delete instance_;

        instance_ = nullptr;
    }

private:
    Singleton() {}
    static Singleton *instance_;
};

Singleton *Singleton::instance_ = nullptr;

int main()
{
    Singleton *singleton1 = Singleton::get();
    dbg(singleton1);

    Singleton *singleton2 = Singleton::get();
    dbg(singleton2);

    Singleton::restart();

    Singleton *singleton3 = Singleton::get();
    dbg(singleton3);

    return 0;
}